// run: time -p $exec < input
// opt: 0
// flag: -g
#include <cstdio>
#include <cstring>
#include <set>

int const maxn = 20;
int const maxs = 1 << maxn;
int sg[maxs * 2];

int calc(int x)
{
	if (sg[x] != -1) return sg[x];
	int a[22], right[22];
	right[21] = 0;
	int tot = 0, tx = x;
	for (; tx; tx /= 2) a[++tot] = tx & 1;
	for (int i = 20; i > tot; i--) right[i] = i;
	for (int i = tot; i >= 1; i--) {
		if (!a[i]) right[i] = i;
		else right[i] = right[i + 1];
	}
	bool vis[22];
	memset(vis, 0, sizeof(vis));
	for (int i = 1; i <= tot; i++) {
		if (!a[i]) continue;
		if (!right[i]) continue;
		int tmp = x ^ (1 << (i - 1)) ^ (1 << (right[i] - 1));
		vis[calc(tmp)] = true;
	}
	int ret = 0;
	for (; vis[ret]; ) ret++;
	return sg[x] = ret;
}

void init()
{
	memset(sg, -1, sizeof(sg));
	sg[0] = 0;
	for (int i = 1; i < maxs; i++) if (sg[i] == -1) calc(i);
}

int n;

int main()
{
	init();
	//    int t1 = (1 << 19) + (1 << 18); printf("%d\n", sg[t1]); return 0;
	int T; scanf("%d", &T);
	while (T--) {
		scanf("%d", &n);
		int ans = 0;
		for (int i = 0; i < n; i++) {
			int tmp = 0, m;
			scanf("%d", &m);
			for (int j = 0, x; j < m; j++) {
				scanf("%d", &x);
				tmp |= (1 << (x - 1));
			}
			ans ^= sg[tmp];
		}
		if (!ans) printf("NO\n");
		else printf("YES\n");
	}
}
